/***************************************************************************
 * EEPROM处理函数
****************************************************************************/ 
#include "stm32f4xx_i2c.h"
#include "stm32f4xx_rcc.h"
#include "AT24Cxx.h"
#define	EPROMMANAGE_H
#include "EepromProcess.h"

//-------------------------------------------------------------
#define UDS_PARA_NUM_BY_WT           3
#define SW_FINGER_EP_ADR     	     3800//0x2100
//-------------------------------------------------------------
extern void Delay_Us(u32 us);
extern void MYI2C_Init(void);
extern uint16                   WriteStep;	
//-------------------------------------------------------------

#define I2Cx             I2C1

//PB8(SCL)  PB9(SDA)
void InitEeprom()
{ 
  MYI2C_Init(); 
}

Uint16 WriteEeprom(Uint16 Address,Uint16 WPara)		
{
  return AT24Cxx_WriteTwoByte(Address,WPara);
}

Uint16 ReadEeprom(Uint16 Address)
{
   return AT24Cxx_ReadTwoByte(Address);   
}

int16_t WriteBootPara(uint16 value)
{
	if (WriteEeprom(BOOT_LOG,value) == RET_OK)
	{
		if (ReadEeprom(BOOT_LOG) == value)	return 1;
	}

	return 0;
}

Uint16 Read2Para16Bit(Uint16 Address,Uint16 *data)
{
  Uint16 RetData;
  
   RetData = AT24Cxx_ReadTwoByte(Address);
   data[0] = RetData;

   RetData = AT24Cxx_ReadTwoByte(Address+2);
   data[1] = RetData;

   return RetData;  
}


